import { ApiProperty } from '@nestjs/swagger';

interface ResTokenDto {
    access_token: string;
    expires_in: number;
}

interface WxNetWorkDto {
    dns: WxNetWorkDtoDn[];
    ping: WxNetWorkDtoPing[];
}

interface WxNetWorkDtoDn {
    ip: string;
    real_operator: string;
}

interface WxNetWorkDtoPing {
    ip: string;
    from_operator: string;
    package_loss: string;
    time: string;
}

class WxUserInfoDto {
    @ApiProperty({description: '是否订阅该公众号标识，值为0时，代表此用户没有关注该公众号，拉取不到其余信息'})
    subscribe: number;
    @ApiProperty({description: '用户的标识，对当前公众号唯一'})
    openid: string;
    nickname: string;
    sex: number;
    language: string;
    city: string;
    province: string;
    country: string;
    headimgurl: string;
    subscribe_time: number;
    unionid: string;
    remark: string;
    groupid: number;
    tagid_list: number[];
    subscribe_scene: string;
    qr_scene: number;
    qr_scene_str: string;
}
interface WxWebAuthModel {
    access_token: string;
    expires_in: number;
    refresh_token: string;
    openid: string;
    scope: string;
}

// tslint:disable-next-line: max-classes-per-file
class WxQRTicketModel {
    @ApiProperty({description: '获取的二维码ticket，凭借此ticket可以在有效时间内换取二维码'})
    ticket: string;
    @ApiProperty({description: '该二维码有效时间，以秒为单位。 最大不超过2592000'})
    expire_seconds: number;
    @ApiProperty({description: '二维码图片解析后的地址，开发者可根据该地址自行生成需要的二维码图片'})
    url: string;
}

// tslint:disable-next-line: max-classes-per-file
class WxJsApiTicketModel {
    @ApiProperty({description: '错误吗'})
    errcode: string;
    @ApiProperty({description: '错误'})
    errmsg: number;
    @ApiProperty({description: '票据'})
    ticket: string;
    @ApiProperty({description: '过期'})
    expires_in: string;
}

export { ResTokenDto, WxNetWorkDto, WxNetWorkDtoDn, WxNetWorkDtoPing, WxUserInfoDto, WxWebAuthModel, WxQRTicketModel, WxJsApiTicketModel };
